﻿Imports System
Imports System.Workflow.ComponentModel
Imports System.Workflow.ComponentModel.Design

Namespace System.Workflow.Activities
    <ActivityDesignerTheme(GetType(SequentialWorkflowDesignerTheme))> _
    Friend Class SequentialWorkflowDesigner
        Inherits SequentialWorkflowRootDesigner
        ' Methods
        Protected Overrides Sub Initialize(ByVal activity As Activity)
            MyBase.Initialize(activity)
            Me.HelpText = DR.GetString("SequentialWorkflowHelpText")
            Me.Header.Text = DR.GetString("StartSequentialWorkflow")
        End Sub

        Protected Overrides Function IsSupportedActivityType(ByVal activityType As Type) As Boolean
            Return (((Not GetType(SetStateActivity).IsAssignableFrom(activityType) AndAlso Not GetType(StateActivity).IsAssignableFrom(activityType)) AndAlso (Not GetType(StateInitializationActivity).IsAssignableFrom(activityType) AndAlso Not GetType(StateFinalizationActivity).IsAssignableFrom(activityType))) AndAlso MyBase.IsSupportedActivityType(activityType))
        End Function

        Protected Overrides Sub OnViewChanged(ByVal view As DesignerView)
            MyBase.OnViewChanged(view)
            Dim designer As ActivityDesigner = If((Not MyBase.ActiveView Is Nothing), MyBase.ActiveView.AssociatedDesigner, Nothing)
            If TypeOf designer.Activity Is FaultHandlersActivity Then
                Me.Header.Text = DR.GetString("WorkflowExceptions")
                Me.HelpText = String.Empty
            ElseIf TypeOf designer.Activity Is EventHandlersActivity Then
                Me.Header.Text = DR.GetString("WorkflowEvents")
                Me.HelpText = String.Empty
            ElseIf TypeOf designer.Activity Is CompensationHandlerActivity Then
                Me.Header.Text = DR.GetString("WorkflowCompensation")
                Me.HelpText = String.Empty
            ElseIf TypeOf designer.Activity Is CancellationHandlerActivity Then
                Me.Header.Text = DR.GetString("WorkflowCancellation")
                Me.HelpText = String.Empty
            Else
                Me.Header.Text = DR.GetString("StartSequentialWorkflow")
                Me.HelpText = DR.GetString("SequentialWorkflowHelpText")
            End If
        End Sub

    End Class
End Namespace

